#include "problems/2.h"
#include "utils/list.h"
#include "gtest/gtest.h"
#include <vector>

using namespace std;

TEST(TestProblemSolutions, TestProblem2)
{
    ListNode node1(2);
    ListNode node2(4);
    ListNode node3(3);
    ListNode node4(5);
    ListNode node5(6);
    ListNode node6(4);
    node1.next = &node2;
    node2.next = &node3;
    node4.next = &node5;
    node5.next = &node6;

    problem_2::Solution s;
    auto result = s.addTwoNumbers(&node1, &node4);
    vector<int> ans{7, 0, 8};
    auto cur = result;
    for (int i = 0; i < ans.size(); ++i)
    {
        ASSERT_NE(cur, nullptr);
        ASSERT_EQ(cur->val, ans[i]);
        cur = cur->next;
    }
    deleteList(result);
}